<template>
  <view class="goods-item">
    <view class="goods-item-left">
      <image :src="goods.goods_small_logo"></image>
    </view>
    <view class="goods-item-right">
      <view class="goods-name">
        <text>{{goods.goods_name}}</text>
      </view>
      <view class="goods-price">
        <text>￥{{goods.goods_price | tofixed}}</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name: "goods",
    props: ['goods'],
    data() {
      return {

      };
    },
    filters: {
      // 把数字处理为带两位小数点的数字
      tofixed(num) {
        return Number(num).toFixed(2)
      }
    }
  }
</script>

<style lang="scss" scoped>
  .goods-item {

    display: flex;

    padding: 15px 5px;

    border-bottom: 1px solid #f0f0f0;

    .goods-item-left {
      margin-right: 5px;

      image {
        width: 100px;
        height: 100px;
      }
    }

    .goods-item-right {

      display: flex;
      justify-content: space-between;
      flex-direction: column;

      .goods-name {
        font-size: 12px;
      }

      .goods-price {
        font-size: 15px;
        color: red;
        font-weight: bold;
      }

    }
  }
</style>
